<?php

namespace Viettrans\FrontBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

/**
 * @Route("/default")
 */
class DefaultController extends Controller {
    /**
     * @Route("/success", name="default_success")
     * @Template()
     */
    public function successAction() {
        # Get session object
        $session = $this->get('session');

        if($session->hasFlash('message')) {
            return array('message' => $session->getFlash('message'));
        } else {
            return array('message' => '');
        }
    }
	
    /**
     * @Route("/error", name="default_error")
     * @Template()
     */
    public function errorAction() {
        # Get session object
        $session = $this->get('session');

        if($session->hasFlash('message')) {
            return array('message' => $session->getFlash('message'));
        } else {
            return array('message' => '');
        }
    }
	
    /**
     * @Route("/intro", name="default_intro")
     * @Template()
     */
	public function introAction() {
		return array();
	}
	
    /**
     * @Route("/sitemap", name="default_sitemap")
     * @Template()
     */
	public function sitemapAction() {
		return array();
	}
	 
    /**
     * @Route("/help", name="default_help")
     * @Template()
     */
	public function helpAction() {
		return array();
	}
	 
    /**
     * @Route("/contact", name="default_contact")
     * @Template()
     */
	public function contactAction() {
		return array();
	}
	
    /**
     * @Route("/locale/{locale}/{currentRoute}", name="default_locale")
     * @Template()
     */
	public function localeAction($locale, $currentRoute) {
		$session = $this->get('session');
		
		$session->setLocale($locale);
		
		return $this->redirect($this->generateUrl($currentRoute));
	}
}
